package Tread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Example4_Executors {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(10);//同一时刻最多只有 10 个线程并发执行任务；
        for (int i = 0; i < 100; i++) {
            executorService.submit(new Task());
            System.out.println(i);
        }

        executorService.shutdown();
    }
}

class Task implements Runnable {
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName()+":===========");
    }
}
